NCTAudioFile2Lib

NCTAudioStudio2 ActiveX DLLs
NCTAudioFile2 ActiveX DLL

Version 2.2

With NCTAudioFile2 you can:

  • Open audio files.

  • Read audio data from open files.

  • Change current position in an audio file.

  • Create new audio files.

  • Set the format of audio files.

  • Write audio data to audio files.

  • Convert audio files from one format to another.

  • Split and append audio files.

The following audio formats are supported:

  • Uncompressed WAV PCM;

  • Compressed WAV (GSM, ADPCM, DSP and others);

  • MP2 (MPEG 1/2 Layer-2);

  • MP3 (MPEG 1/2 Layer-3);

  • VOX (Dialogic ADPCM);

  • RAW audio (PCM, A-LAW, U-LAW);

  • WMA (Windows Media Audio);

  • MPC (MusicPack);

  • AVI (audio track);

  • G.726, G.723, G.721;

  • Ogg Vorbis (Version 1.0);

  • AIFF (Apple audio format);

  • AU (UNIX audio format).

NCTAudioFile2 is a part of the NCTAudioStudio2 package.

Send Feedback on the NCTAudioFile2 documentation.
NCTAudioFile2 was developed by NCT Company Ltd. http://www.nctsoft.com


NCTAudioFile2 objects

NCTAudioFile2 objects

Object | Description
AudioFile2 | The AudioFile2 object is intended for getting audio data from an audio file and writing audio data to an audio file.
AudioFile2LameEnc | The AudioFile2LameEnc object is intended for changing the parameters of the lame mp3 encoder.


AudioFile2

AudioFile2 object

The AudioFile2 object is intended for getting audio data from an audio file and writing audio data to an audio file.

Send Feedback on the NCTAudioFile2 documentation.
NCTAudioFile2 was developed by NCT company http://www.nctsoft.com


AudioFile2 Properties

Properties (AudioFile2 object)

Property | Type | Default | Description
ArrayChannels | ChannelsConstants | STEREO | Read-only property that returns the number of channels of the audio array, set by the SetFormatArray method. Monaural data uses one channel and stereo data uses two channels.
ArrayFrequency | FrequencyConstants | FQ_44_KHZ | Read-only property that returns the frequency of the audio array, set by the SetFormatArray method.
Bitrate | Long |  | Read-only property that returns the bitrate of the audio file, opened by the OpenFile method or created by the CreateFile method.
BitsPerSample | BitsPerSampleConstants |  | Read-only property that returns the number of bits per sample in the audio file, opened by the OpenFile method or created by the CreateFile method.
Duration | Long |  | Read-only property that returns the duration of the audio file, opened by the OpenFile method or created by the CreateFile method.
FormatString | String |  | Read-only property that returns the string with information about the format of the audio file, opened by the OpenFile method or created by the CreateFile method.
FormatTag | Long |  | Read-only property that returns the format tag of the audio file, opened by the OpenFile method or created by the CreateFile method.
Frequency | FrequencyConstants |  | Read-only property that returns the frequency of the audio file, opened by the OpenFile method or created by the CreateFile method.
G723BitsPerSample | BitsPerSampleConstants |  | Read-only property that returns the bitrate of the G.723 audio file, opened by the OpenFile method or created by the CreateFile method.
G726BitsPerSample | BitsPerSampleConstants |  | Read-only property that returns the bitrate of the G.726 audio file, opened by the OpenFile method or created by the CreateFile method.
LastErrorNum | ErrorConstants |  | Read-only property that returns the number of the last error.
Mp3LameEncoder | AudioFile2LameEnc |  | Read-only property that returns to AudioFile2LameEnc object which used for changing parameters of lame mp3 encoder. This property opened by the OpenFile method or created by the CreateFile method.
Mp3DecoderType | Mp3DecoderConstants |  | Gets or sets the type of mp3 decoder, opened by the OpenFile method or created by the CreateFile method.
Mp3EncoderType | Mp3EncoderConstants |  | Gets or sets the type of mp3 encoder, opened by the OpenFile method or created by the CreateFile method.
nChannels | ChannelsConstants |  | Read-only property that returns the number of channels in the audio file, opened by the OpenFile method or created by the CreateFile method. Monaural data uses one channel and stereo data uses two channels.
nSamples | Long |  | Read-only property that returns the number of samples in the audio file, opened by the OpenFile method or created by the CreateFile method.
RawTypeCompress | RawTypeCompressConstants | PCM | Read-only property that returns the compression type for the RAW audio file, opened by the OpenFile method or created by the CreateFile method.
Status | Integer |  | Read-only property that returns the current status of the control.
WmaFormatEnabled | Boolean |  | Gets or sets a flag indicating if WMA format is enabled or not.


ArrayChannels property (AudioFile2)

ArrayChannels property (AudioFile2)

Read-only property that returns the number of channels of the audio array, set by the SetFormatArray method. Mono data uses one channel and stereo data uses two channels.

Property type

A ChannelsConstants value.

Syntax

object.ArrayChannels [= value]

The ArrayChannels property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | ChannelsConstants | The number of channels.

Remarks:

If you didn't apply the SetFormatArray method, this property is set in accordance with the format of the file, opened by the OpenFile method or created by the CreateFile method.

Example:

' VB sample where AudioFile is an AudioFile2 objects.
Dim nChannels As ChannelsConstants
nChannels = AudioFile.ArrayChannels

See Also:

ArrayFrequency

Applies to: AudioFile2


ArrayFrequency property (AudioFile2)

ArrayFrequency property (AudioFile2)

Read-only property that returns the frequency of the audio array, set by the SetFormatArray method.

Property type

A FrequencyConstants value.

Syntax

object.ArrayFrequency [= value]

The ArrayFrequency property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | FrequencyConstants | The frequency of the audio array.

Remarks:

If you didn't apply the SetFormatArray method, this property is set in accordance with the format of the file, opened by the OpenFile method or created by the CreateFile method.

Example:

' VB sample where AudioFile is an AudioFile2 objects.
Dim Frequency As FrequencyConstants
Frequency = AudioFile.ArrayFrequency

See Also:

ArrayChannels

Applies to: AudioFile2


Bitrate property (AudioFile2)

Bitrate property (AudioFile2)

Read-only property that returns the bitrate of the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A Long value.

Syntax

object.Bitrate [= value]

The Bitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Long | Bitrate is in bits per second.

Remarks:

This property returns values from 8000 to 350000. It is necessary to divide the returned value by 1000 to harmonize it with the BitrateConstants enumeration.

Example:

' VB sample where File is AudioFile2 objects.
Dim Caption As String
Caption = "Current bitrate: " & File.Bitrate / 1000 & " kbit"

See Also:

Applies to: AudioFile2


BitsPerSample property (AudioFile2)

BitsPerSample property (AudioFile2)

Read-only property that returns the number of bits per sample in the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A BitsPerSampleConstants value.

Syntax

object.BitsPerSample [= value]

The BitsPerSample property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | BitsPerSampleConstants | Number of bits per sample.

Example:

' VB sample where File is AudioFile2 objects.
Caption = "Current number of bits per sample: " & File.BitsPerSample & " kbit"

See Also:

Applies to: AudioFile2


Duration property (AudioFile2)

Duration property (AudioFile2)

Read-only property that returns the duration of the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A Long value.

Syntax

[value = ]object.Duration

The Duration property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Long | The duration is in milliseconds.

Remarks:

This property is changed after applying the WriteFile method.

Example:

' VB sample where File is AudioFile2 objects.
Dim Caption1 As String
Dim Caption2 As String
Caption1 = "Current bitrate: " & File.Bitrate & " kbit"
Caption2 = "Duration of the current file: " & File.Duration & " ms"

See Also:

Applies to: AudioFile2


FormatString property (AudioFile2)

FormatString property (AudioFile2)

Read-only property that returns the string with information about the format of the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A String value.

Syntax

[value = ]object.FormatString

The FormatString property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object .
value | String | Information about the format.

Example:

' VB sample where File is an AudioFile2 object.
Dim Format As String
Format = File.FormatString
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
Format = File.FormatString
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
Format = File.FormatString
ElseIf TypeComp = 3 Then
File.SetFormatDSP
Format = File.FormatString
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
Format = File.FormatString
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
Format = File.FormatString
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
Format = File.FormatString
End If

See Also:

Applies to: AudioFile2


FormatTag property (AudioFile2)

FormatTag property (AudioFile2)

Read-only property that returns the format tag of the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A Long value.

Syntax

[value = ]object.FormatTag

The FormatTag property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Long | Format tag of the audio file.

See Also:

Applies to: AudioFile2


Frequency property (AudioFile2)

Frequency property (AudioFile2)

Read-only property that returns the frequency of the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A FrequencyConstants value.

Syntax

[value = ]object.Frequency

The Frequency property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
value | FrequencyConstants | Frequency of an audio file.

See Also:

Applies to: AudioFile2


G723BitsPerSample property (AudioFile2)

G723BitsPerSample property (AudioFile2)

Read-only property that returns the number of bits per sample in the G.723 audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A BitsPerSampleConstants value.

Syntax:

[value = ]object.G723BitsPerSample

The G723BitsPerSample property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | BitsPerSampleConstants | Number of bits per sample of the G.723 audio file.

Example:

' VB sample where File is AudioFile2 objects.
Dim Caption As String
If File.G723BitsPerSample = BPS_2_BIT Than
Caption = "2 bits per sample"
ElseIf File.G723BitsPerSample = BPS_3_BIT Than
Caption = "3 bits per sample"
ElseIf File.G723BitsPerSample = BPS_4_BIT Than
Caption = "4 bits per sample"
ElseIf File.G723BitsPerSample = BPS_5_BIT Than
Caption = "5 bits per sample"
ElseIf File.G723BitsPerSample = BPS_8_BIT Than
Caption = "8 bits per sample"
ElseIf File.G723BitsPerSample = BPS_16_BIT Than
Caption = "16 bits per sample"
EndIf

See Also:

Applies to: AudioFile2


G726BitsPerSample property (AudioFile2)

G726BitsPerSample property (AudioFile2)

Read-only property that returns the number of bits per sample in the G.726 audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A BitsPerSampleConstants value.

Syntax

[value = ]object.G726BitsPerSample

The G726BitsPerSample property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
value | BitsPerSampleConstants | Number of bits per sample of the G.726 audio file.

Example:

' VB sample where File is AudioFile2 objects.
Dim Caption As String
If File.G726BitsPerSample = BPS_2_BIT Than
Caption = "2 bits per sample"
ElseIf File.G726BitsPerSample = BPS_3_BIT Than
Caption = "3 bits per sample"
ElseIf File.G726BitsPerSample = BPS_4_BIT Than
Caption = "4 bits per sample"
ElseIf File.G726BitsPerSample = BPS_5_BIT Than
Caption = "5 bits per sample"
ElseIf File.G726BitsPerSample = BPS_8_BIT Than
Caption = "8 bits per sample"
ElseIf File.G726BitsPerSample = BPS_16_BIT Than
Caption = "16 bits per sample"
EndIf

See Also:

Applies to: AudioFile2


LastErrorNum property (AudioFile2)

LastErrorNum property (AudioFile2)

Read-only property that returns the number of the last error.

Property type

An ErrorConstants value.

Syntax

[value = ]object.LastErrorNum

The LastErrorNum property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
value | ErrorConstants | Number of the last error.

Remarks:

You can use two ways for getting errors: using standard error processor from VB or using the LastErrorNum property.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
FileR.OpenFile FileName1
'Opens an input file, path and filename are stored in Filename1 string
    If FileR.LastErrorNum < 0 Then
        MsgBox FileR.LastErrorNum
        GoTo P
    End If
    'if any error occurs during opening file goto P (exiting phase of this sub)

    FileW.CreateFile FileName2
    If FileW.LastErrorNum < 0 Then
        MsgBox FileW.LastErrorNum
        GoTo P
    End If
    'if any error occurs during creating file goto P (exiting phase of this sub)

    FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels
    'Sets audio file format using FileR frequency and nChannels
    BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency
    'Sets the BufferSize to the Frequency of an input audio file
    CurrentSamples = 0  'Sets the current sample to zero
    Do While True
        Wav() = FileR.ReadFile(BufferSize)
        'reads from an audio file a piece of data of Buffer size to the Wav variable
        If UBound(Wav) + 1 = 0 Then Exit Do
        FileW.WriteFile Wav()
        'otherwise write currently read data block to the new created audio file
        CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels
        'enlarge number of the currently read samples
        If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples
        'if number of the currently read samples is more than the one in an AudioFile2
        ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples
        'the value of progress bar line equals 100%*Currently read samples/Samples at all
        DoEvents
        If flgConvert = False Then Exit Do
    Loop

    ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
FileW.CloseFile
P:
FileR.CloseFile              'Close an input audio file

See Also:

Applies to: AudioFile2


Mp3DecoderType property (AudioFile2)

Mp3DecoderType property (AudioFile2)

Gets or sets the type of mp3 decoder, opened by the OpenFile method or created by the CreateFile method.

Property type

A Mp3DecoderConstants value.

Syntax

object.Mp3DecoderType [= value]

The Mp3DecoderType property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Mp3DecoderConstants | Type of mp3 decoder.

See Also:

Applies to: AudioFile2


Mp3EncoderType property (AudioFile2)

Mp3EncoderType property (AudioFile2)

Gets or sets the type of mp3 encoder, opened by the OpenFile method or created by the CreateFile method.

Property type

A Mp3EncoderConstants value.

Syntax

object.Mp3EncoderType [= value]

The Mp3EncoderType property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Mp3EncoderConstants | Type of mp3 encoder.

See Also:

Applies to: AudioFile2


nChannels property (AudioFile2)

nChannels property (AudioFile2)

Read-only property that returns the number of channels in the audio file, opened by the OpenFile method or created by the CreateFile method. Mono data uses one channel and stereo data uses two channels.

Property type

A ChannelsConstants value.

Syntax

[value = ]object.nChannels

The nChannels property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | ChannelsConstants | Number of channels.

See Also:

Applies to: AudioFile2


nSamples property (AudioFile2)

nSamples property (AudioFile2)

Read-only property that returns the number of samples in the audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A Long value.

Syntax

[value = ]object.nSamples

The nSamples property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Long | Number of samples.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

Applies to: AudioFile2


RawTypeCompress property (AudioFile2)

RawTypeCompress property (AudioFile2)

Read-only property that returns the compression type for the RAW audio file, opened by the OpenFile method or created by the CreateFile method.

Property type

A RawTypeCompressConstants value.

Syntax

[value = ]object.RawTypeCompress

The RawTypeCompress property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | RawTypeCompressConstants | By default this property is set to PCM.

Remarks:

This property is set by the SetFormatRAW method.

See Also:

Applies to: AudioFile2


Status property (AudioFile2)

Status property (AudioFile2)

Read-only property that returns the current status of the control.

Property type

An Integer value.

Syntax

[value = ]object.Status

The Status property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Integer | Status of control: 0 - an audio file isn't opened, 1- an audio file is opened by the OpenFile method, 2 - An audio file is created by the CreateFile method.

See Also:

Applies to: AudioFile2


WmaFormatEnabled property (AudioFile2)

WmaFormatEnabled property (AudioFile2)

Gets or sets a flag indicating if WMA format is enabled or not.

Property type

A Boolean value.

Syntax

object.WmaFormatEnabled [= value]

The WmaFormatEnabled property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | Boolean | Can be True (WMA format is enabled) or False (WMA format is disabled).

Example:

' VB sample where File is an AudioFile2 object.
File.WmaFormatEnabled = True
File.SetFormatWMA 32

See Also:

Applies to: AudioFile2


AudioFile2 Methods

Methods (AudioFile2 object)

Method | Description
CloseFile | Closes the audio file, opened by the OpenFile method or created by the CreateFile method.
CreateFile | Creates an output file for writing using the WriteFile method.
IsFormatMpegAvailable | Indicates if the parameters are supported by Mpeg codec or not.
IsFormatOggVorbisAvailable | Indicates if the parameters are supported by Ogg Vorbis codec or not.
OpenFile | Opens an audio file for reading, using the ReadFile method.
ReadFile | Reads an array from the current position of an audio file, opened before by the OpenFile method.
Register | Enters user name and registration password to disable About window.
SeekFile | Sets the current position in an audio file, opened by the OpenFile method.
SetFormatADPCM | Sets the format of an ADPCM audio file.
SetFormatALAW | Sets the format of an A-law audio file.
SetFormatALF2CD | Sets the format of an ALF2 CD audio file.
SetFormatArray | Sets the format of audio data. Audio data is an Integer array in the PCM format. Audio data is read from a file by the ReadFile method and is written to a file by the WriteFile method.
SetFormatDSP | Sets the format of a DSP Group TrueSpeech (TM) audio file.
SetFormatFromMenu | Sets the format of an audio file. This method calls the standard Windows menu in which you can pick up parameters of an audio file.
SetFormatG721 | Sets the format of a G.721 audio file.
SetFormatG723 | Sets the format of a G.723 audio file.
SetFormatG726 | Sets the format of a G.726 audio file.
SetFormatGSM | Sets the format of a GSM audio file.
SetFormatLikeSample | Sets the format of an audio file according to the format of the chosen example file.
SetFormatMobileVoice | Sets the format of a Mobile Voice audio file.
SetFormatMP2 | Sets the format of an MP2 audio file.
SetFormatMP3 | Sets the format of an MP3 audio file.
SetFormatOggVorbis | Sets the format of an Ogg Vorbis audio file.
SetFormatPCM | Sets the format of a PCM audio file.
SetFormatRAW | Sets the format of a RAW audio file.
SetFormatULAW | Sets the format of an U-law audio file.
SetFormatVOX | Sets the format of a VOX audio file.
SetFormatWMA | Sets the format of a WMA audio file.
WriteFile | Writes an audio data array to an audio file, created by the CreateFile method.


CloseFile method

CloseFile method

Closes the audio file, opened by the OpenFile method or created by the CreateFile method.

Syntax

object.CloseFile()

The CloseFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

CreateFile | OpenFile | ReadFile | SeekFile | WriteFile

Applies to: AudioFile2


CreateFile method

CreateFile method

Creates an output file for writing using the WriteFile method.

Syntax

object.CreateFile(fileName As String, FormatType As FormatTypeConstants)

The CreateFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
fileName | String | Pathname of the audio file.
FormatType | FormatTypeConstants | Format of the audio file. By default the FormatType is equal to DEFAULT.

Remarks:

An audio file can be closed by the CloseFile method.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

CloseFile | OpenFile | ReadFile | SeekFile | WriteFile

Applies to: AudioFile2


IsFormatMpegAvailable method

IsFormatMpegAvailable method (AudioFile2 object)

Indicates if the parameters are supported by Mpeg codec or not.

Return Type

A Boolean value.

Syntax

MpegFormat = object.IsFormatMpegAvailable(Frequency As FrequencyConstants, Bitrate As BitrateConstants, Channels As ChannelsConstants)

The IsFormatMpegAvailable method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of a Mpeg file. By default the Frequency is equal to FQ_44_KHZ.
Bitrate | BitrateConstants | Bitrate of a Mpeg file. By default the Bitrate is set to BR_128_KBPS.
Channels | ChannelsConstants | Number of channels of a Mpeg file.
MpegFormat | Boolean | True if Mpeg parameters have correct values, otherwise - False.

Remarks:

This method is recommended to use before applying SetFormatMP2 or SetFormatMP3 methods.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
If File.IsFormatMpegAvailable(LameEnc.Frequency, LameEnc.Bitrate, LameEnc.Channels) = True Then 'MP3
File.SetFormatMP3 LameEnc.Frequency, LameEnc.Bitrate, LameEnc.Channels
End If

See Also:

SetFormatMP2 | SetFormatMP3

Applies to: AudioFile2

Send Feedback on the NCTAudioFile2 documentation.
NCTAudioFile2 was developed by NCT company http://www.nctsoft.com


IsFormatOggVorbisAvailable method

IsFormatOggVorbisAvailable method (AudioFile2 object)

Indicates if the parameters are supported by Ogg Vorbis codec or not.

Return Type

A Boolean value.

Syntax

OggVorbis Format = object.IsAvailableFormatOggVorbis(Frequency As FrequencyConstants, nChannels As ChannelsConstants, NominalBitrate As BitrateConstants, MinBitrate As BitrateConstants, MaxBitrate As BitrateConstants)

The IsFormatOggVorbisAvailable method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of the audio file. By default the Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of the audio file. By default the nChannels is equal to STEREO.
NominalBitrate | BitrateConstants | Bitrate of the audio file. By default the NominalBitrate is equal to BR_128_KBPS.
MinBitrate | BitrateConstants | Minimal bitrate. By default the MinBitrate is equal to BR_NONE.
MaxBitrate | BitrateConstants | Maxilmal bitrate. By default the MaxBitrate is equal to BR_NONE.
OggVorbis Format | Boolean | True if Ogg Vorbis parameters have correct values, otherwise - False.

Remarks:

This method is recommended to use before applying SetFormatOggVorbis method.

Example:

' VB sample where File is an AudioFile2 object.
If flag = 1 Then
If File.IsFormatOggVorbisAvailable(, , Bitrate, MinBitrate, MaxBitrate) = True Then
File.SetFormatOggVorbis , , Bitrate, MinBitrate, MaxBitrate
EndIf
ElseIf flag = 2 Then
If File.IsFormatOggVorbisAvailable(, , Bitrate, MinBitrate, MaxBitrate) = True Then
File.SetFormatOggVorbis , , , , , Quality
EndIf
EndIf

See Also:

SetFormatOggVorbis

Applies to: AudioFile2


OpenFile method

OpenFile method

Opens an audio file for reading, using the ReadFile method.

Syntax

object.OpenFile(fileName As String, FormatType As FormatTypeConstants, FlagOpen As FlagOpen)

The OpenFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
fileName | String | Pathname of an audio file.
FormatType | FormatTypeConstants | Format of an audio file. By default the FormatType is equal to DEFAULT.
FlagOpen | FlagOpen | Specifies if a file is opened for reading or for reading and rewriting. By default the FlagOpen is equal to READ.

Remarks:

An audio file can be closed by the CloseFile method.

If a file has a wrong extension, you should not change it. You can use FormatType parameter of OpenFile method to set the proper format. For example: if you have a RAW file with .VOX extension, you can set FormatType to RAW thus you should not rename the file.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

CloseFile | CreateFile | ReadFile | SeekFile | WriteFile

Applies to: AudioFile2


ReadFile method

ReadFile method

Reads an array from the current position of the audio file, opened before by the OpenFile method.

Return Type

An Integer() value.

Syntax

AudioArray() = object.ReadFile(nSamples As Long)

The ReadFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
nSamples | Long | Number of read samples.
AudioArray() | Integer | Array of read audio data.

Remarks:

The output array contains audio in the uncompressed PCM format. The array is a sequence of audio levels for each sample in the file, if the file is mono. And if the file is stereo it is an array of audio levels for samples of R, L, R, L. channels. It returns integer values. The max and min values for each level in the array are - 32767 and +32767.

If the array are full of zero values (or values less than particular level) it means that the selected part of a sound is silence.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

CloseFile | CreateFile | OpenFile | SeekFile | WriteFile

Applies to: AudioFile2


Register method

Register method

Enters user name and registration password to disable About window.

Syntax

object.Register(bstrUser As String, bstrPassword As String)

The Register method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
bstrUser | String | User name. You get a registration user name after the registration.
bstrPassword | String | Password string. You get a registration password after the registration.

Example:

' VB sample where File is an AudioFile2 object.
File.Register "XXX", "XXX"

See Also:

Applies to: AudioFile2


SeekFile method

SeekFile method

Sets the current position in an audio file, opened by the OpenFile method.

Return Type

A Long value.

Syntax

NewPosition = object.SeekFile(nSamples As Long, Origin As FileSeekConstants)

The SeekFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
nSamples | Long | Number of samples from the origin position.
Origin | FileSeekConstants | Type of the origin position. By default the Origin is set to Begin.
NewPosition | Long | New current position in an audio file. Number of samples from the beginning of file.

See Also:

CloseFile | CreateFile | OpenFile | ReadFile | WriteFile

Applies to: AudioFile2


SetFormatADPCM method

SetFormatADPCM method

Sets the format of an ADPCM audio file.

Syntax

object.SetFormatADPCM(Frequency As FrequencyConstants, nChannels As ChannelsConstants)

The SetFormatADPCM method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an audio file. By default the Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default the nChannels is equal to STEREO.

Remarks:

You should apply this method before creating ADPCM file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatALAW method

SetFormatALAW method

Sets the format of an A-law audio file.

Syntax

object.SetFormatALAW(Frequency As FrequencyConstants, nChannels As ChannelsConstants)

The SetFormatALAW method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an audio file. By default the Frequency is equal to FQ_8_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default he nChannels is equal to MONO.

Remarks:

You should apply this method before creating ADPCM file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatADPCM | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatArray method

SetFormatArray method

Sets the format of audio data. Audio data is an Integer array in the PCM format. Audio data is read from a file by the ReadFile method and is written to a file by the WriteFile method.

Syntax

object.SetFormatArray(Frequency As FrequencyConstants, nChannels As ChannelsConstants)

The SetFormatArray method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
Frequency | FrequencyConstants | Frequency of an audio file. By default the Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default the nChannels is equal to STEREO.

Remarks:

This method sets the ArrayFrequency and the ArrayChannels properties.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
FileW.SetFormatArray FQ_44_KHZ, STEREO

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatDSP method

SetFormatDSP method

Sets the format of a DSP Group TrueSpeech (TM) audio file.

Syntax

object.SetFormatDSP()

The SetFormatDSP method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.

Remarks:

You should apply this method before creating DSP file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatFromMenu method

SetFormatFromMenu method

Sets the format of the audio file. This method calls the standard Windows menu in which you can pick up parameters of the audio file.

Syntax

object.SetFormatFromMenu()

The SetFormatFromMenu method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.

Remarks:

You should apply this method before the CreateFile method.

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatG721 method

SetFormatG721 method

Sets the format of a G.721 audio file.

Syntax

object.SetFormatG721(Frequency As FrequencyConstants)

The SetFormatG721 method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of a G.721 audio file. By default the frequency is equal to FQ_8_KHZ.

Remarks:

You should apply this method before creating G.721 file by the CreateFile method or before opening G.721 file by the OpenFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatG721 Freq
ElseIf TypeComp = 2 Then
File.SetFormatG723 Freq, BitsPerSample
ElseIf TypeComp = 3 Then
File.SetFormatG726 Freq, BitsPerSample
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatG723 method

SetFormatG723 method

Sets the format of a G.723 audio file.

Syntax

object.SetFormatG723(Frequency As FrequencyConstants, BitsPerSample As BitsPerSampleConstants)

The SetFormatG723 method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
Frequency | FrequencyConstants | Frequency of a G.723 audio file. By default the frequency is equal to FQ_8_KHZ.
BitsPerSample | BitsPerSampleConstants | Number of bits per sample of an audio file. By default the BitsPerSample is equal to BPS_3_BIT. Can accept BPS_3_BIT and BPS_5_BIT values.

Remarks:

You should apply this method before creating G.723 file by the CreateFile method or before opening G.723 file by the OpenFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatG721 Freq
ElseIf TypeComp = 2 Then
File.SetFormatG723 Freq, BitsPerSample
ElseIf TypeComp = 3 Then
File.SetFormatG726 Freq, BitsPerSample
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatG726 method

SetFormatG726 method

Sets the format of a G.726 audio file.

Syntax

object.SetFormatG726(Frequency As FrequencyConstants, BitsPerSample As BitsPerSampleConstants)

The SetFormatG726 method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object of type .
Frequency | FrequencyConstants | Frequency of a G.726 audio file. By default the frequency is equal to FQ_8_KHZ.
BitsPerSample | BitsPerSampleConstants | Number of bits per sample of the audio file. By default the BitsPerSample is equal to BPS_4_BIT. Can accept BPS_2_BIT, BPS_3_BIT, BPS_4_BIT and BPS_5_BIT values.

Remarks:

You should apply this method before creating G.726 file by the CreateFile method or before opening G.726 file by the OpenFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatG721 Freq
ElseIf TypeComp = 2 Then
File.SetFormatG723 Freq, BitsPerSample
ElseIf TypeComp = 3 Then
File.SetFormatG726 Freq, BitsPerSample
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatGSM method

SetFormatGSM method

Sets the format of a GSM audio file.

Syntax

object.SetFormatGSM(Frequency As FrequencyConstants)

The SetFormatGSM method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of a GSM audio file. By default the frequency is equal to FQ_8_KHZ.

Remarks:

You should apply this method before creating GSM file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatLikeSample method

SetFormatLikeSample method

Sets the format of an audio file according to the format of the chosen example file.

Syntax

object.SetFormatLikeSample(fileName As String)

The SetFormatLikeSample method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
fileName | String | Pathname of a sample audio file.

Example:

' VB sample where File is an AudioFile2 object.
File.SetFormatLikeSample FileName1

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatMP2 method

SetFormatMP2 method

Sets the format of an MP2 audio file.

Syntax

object.SetFormatMP2(Frequency As FrequencyConstants, Bitrate As BitrateConstants, nChannels As Integer)

The SetFormatMP2 method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an MP2 file. By default the Frequency is equal to FQ_44_KHZ.
Bitrate | BitrateConstants | Bitrate of an MP2 file. By default the Bitrate is set to BR_128_KBPS.
nChannels | Integer | Can be one of the following values: 1 - mono, 2 - stereo, 3 - joint stereo. By default is equal to 2.

Example:

' VB sample where File is an AudioFile2 object.
If File.IsFormatMpegAvailable(LameEnc.Frequency, LameEnc.Bitrate, LameEnc.Channels + LameEnc.TypeStereo - 1) = True Then 'MP2
File.SetFormatMP2 LameEnc.Frequency, LameEnc.Bitrate, LameEnc.Channels + LameEnc.TypeStereo - 1
End If

Remarks:

You should apply this method before creating an MP2 file by the CreateFile method.

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatMP3 method

SetFormatMP3 method

Sets the format of an MP3 audio file.

Syntax

object.SetFormatMP3(Frequency As FrequencyConstants, Bitrate As BitrateConstants, nChannels As ChannelsConstants)

The SetFormatMP3 method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an MP3 file. By default the Frequency is equal to FQ_44_KHZ.
Bitrate | BitrateConstants | Bitrate of an MP3 file. By default the Bitrate is set to BR_128_KBPS.
nChannels | ChannelsConstants | Number of channels of an MP3 file. By default the nChannels is equal to STEREO.

Remarks:

You should apply this method before creating an MP3 file by the CreateFile method.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
If FileW.IsFormatMpegAvailable(FileR.Frequency, FileR.Bitrate / 1000, FileR.nChannels) = True Then 'MP3
FileW.SetFormatMP3 FileR.Frequency, FileR.Bitrate / 1000, FileR.nChannels
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatMP3Ex method

SetFormatMP3Ex method (AudioFile2 object)

Sets the format with specific lame mp3 encoder parameters of an MP3 audio file.

Syntax

object.SetFormatMP3Ex(LameFormat As AudioFile2LameEnc)

The SetFormatMP3Ex method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
LameFormat | AudioFile2LameEnc | An expression evaluating to an object.

Remarks:

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.VbrCodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2

Send Feedback on the NCTAudioFile2 documentation.
NCTAudioFile2 was developed by NCT company http://www.nctsoft.com


SetFormatOggVorbis method

SetFormatOggVorbis method

Sets the format of an Ogg Vorbis audio file.

Syntax

object.SetFormatOggVorbis(Frequency As FrequencyConstants, nChannels As ChannelsConstants, NominalBitrate As BitrateConstants, MinBitrate As BitrateConstants, MaxBitrate As BitrateConstants, Quality As Integer)

The SetFormatOggVorbis method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of an audio file. By default the Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default the nChannels is equal to STEREO.
NominalBitrate | BitrateConstants | Bitrate of an audio file. By default the NominalBitrate is equal to BR_128_KBPS.
MinBitrate | BitrateConstants | Minimal bitrate. By default the MinBitrate is equal to BR_NONE.
MaxBitrate | BitrateConstants | Maxilmal bitrate. By default the MaxBitrate is equal to BR_NONE.
Quality | Integer | Varies from 0 (the best quality and the worst speed) to 1000 (the worst quality and the best speed). By default the Quality is equal to -1 (not used).

Remarks:

You should apply this method before creating an Ogg Vorbis file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If flag = 1 Then
If File.IsFormatOggVorbisAvailable(, , Bitrate, MinBitrate, MaxBitrate) = True Then
File.SetFormatOggVorbis , , Bitrate, MinBitrate, MaxBitrate
EndIf
ElseIf flag = 2 Then
If File.IsFormatOggVorbisAvailable(, , Bitrate, MinBitrate, MaxBitrate) = True Then
File.SetFormatOggVorbis , , , , , Quality
EndIf
EndIf

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatPCM method

SetFormatPCM method

Sets the format of a PCM audio file.

Syntax

object.SetFormatPCM(Frequency As FrequencyConstants, nChannels As ChannelsConstants, BitsPerSample As BitsPerSampleConstants)

The SetFormatPCM method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of a PCM audio file. By default the Frequency is equal to FQ_8_KHZ.
nChannels | ChannelsConstants | Number of channels of a PCM audio file. By default the nChannels is equal to MONO.
BitsPerSample | BitsPerSampleConstants | Number of bits per sample of a PCM audio file. By default the BitsPerSample is equal to BPS_16_BIT.

Remarks:

You should apply this method before creating a PCM file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If cmbTypeFile.ListIndex = 0 Then 'PCM
File.SetFormatPCM Frequency, Channels, BPS_16_BIT
ElseIf cmbTypeFile.ListIndex = 1 Then 'VOX
File.SetFormatVOX Frequency
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatRAW method

SetFormatRAW method

Sets the format of a RAW audio file.

Syntax

object.SetFormatRAW(TypeCompress As RawTypeCompressConstants, Frequency As FrequencyConstants, nChannels As ChannelsConstants, BitsPerSample As BitsPerSampleConstants)

The SetFormatRAW method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
TypeCompress | RawTypeCompressConstants | The type of compression for a RAW file. By default the TypeCompress is equal to PCM.
Frequency | FrequencyConstants | Frequency of an audio file. By default the Frequency is equal to FQ_44_KHZ.
nChannels | ChannelsConstants | Number of channels of an audio file. By default the nChannels is equal to STEREO.
BitsPerSample | BitsPerSampleConstants | Number of bits per sample of an audio file. By default the BitsPerSample is equal to BPS_16_BIT.

Remarks:

You should apply this method before creating a RAW file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
FileR.SetFormatRAW ULAW, Frequency, Channels

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatULAW method

SetFormatULAW method

Sets the format of an U-law audio file.

Syntax

object.SetFormatULAW(Frequency As FrequencyConstants, nChannels As ChannelsConstants)

The SetFormatULAW method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of the audio file. By default the Frequency is equal to FQ_8_KHZ.
nChannels | ChannelsConstants | Number of channels of the audio file. By default the nChannels is equal to MONO.

Remarks:

You should apply this method before creating an U-law file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatVOX method

SetFormatVOX method

Sets the format of a VOX audio file.

Syntax

object.SetFormatVOX(Frequency As FrequencyConstants)

The SetFormatVOX method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of a VOX audio file. By default the Frequency is equal to FQ_8_KHZ.

Remarks:

You should apply this method before creating a VOX file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If cmbTypeFile.ListIndex = 0 Then 'PCM
File.SetFormatPCM Frequency, Channels, BPS_16_BIT
ElseIf cmbTypeFile.ListIndex = 1 Then 'VOX
File.SetFormatVOX Frequency
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatWMA

Applies to: AudioFile2


SetFormatWMA method

SetFormatWMA method

Sets the format of a WMA audio file.

Syntax

object.SetFormatWMA(Profile As Long)

The SetFormatWMA method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Profile | Long | Type of profile of the WMA audio file. By default is equal to 28.

Remarks:

You have to set WmaFormatEnabled property to ‘True’ before using this method.

You can use FormatString property to get the description of the current 'Profile'. At present it is possible to use only 51 profiles. Here is the list of the existing profiles.

Profile | Description | Profile name
1 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Video for dial-up modems or single channel ISDN (28.8 to 56 Kbps)
2 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Video for LAN, cable modem, or xDSL (100 to 768 Kbps)
3 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Video for dial-up modems or LAN (28.8 to 100 Kbps)
4 | WMA 8,000 Hz; 16 Bit; Mono; 4 kbps. | Video with voice emphasis for dial-up modems (28.8 Kbps)
5 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Video with audio emphasis for dial-up modems (28.8 Kbps)
6 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Video for Web servers (28.8 Kbps)
7 | WMA 11,025 Hz; 16 Bit; Mono; 10 kbps. | Video for Web servers (56 Kbps)
8 | WMA 11,025 Hz; 16 Bit; Mono; 10 kbps. | Video for single-channel ISDN (64 Kbps)
9 | WMA 16,000 Hz; 16 Bit; Mono; 16 kbps. | Video for e-mail and dual-channel ISDN (128 Kbps)
10 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Video for broadband NTSC (256 Kbps)
11 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Video for broadband NTSC (384 Kbps)
12 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Video for broadband NTSC (768 Kbps)
13 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Video for broadband NTSC (1500 Kbps total)
14 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Video for broadband NTSC (2 Mbps total)
15 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Video for broadband film content (768 Kbps)
16 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Video for broadband film content (1500 Kbps total)
17 | WMA 8,000 Hz; 16 Bit; Mono; 6 kbps. | Audio for low bit rate voice-oriented content (6.5 Kbps)
18 | WMA 22,050 Hz; 16 Bit; Mono; 20 kbps. | Audio for FM radio quality for dial-up modems (28.8 Kbps mono)
19 | WMA 22,050 Hz; 16 Bit; Stereo; 20 kbps. | Audio for FM radio quality for dial-up modems (28.8 Kbps stereo)
20 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Audio for dial-up modems (56 Kbps stereo)
21 | WMA 32,000 Hz; 16 Bit; Stereo; 48 kbps. | Audio for single-channel ISDN (64 Kbps stereo)
22 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Audio for near-CD quality (64 Kbps stereo)
23 | WMA 44,100 Hz; 16 Bit; Stereo; 96 kbps. | Audio for CD-quality (96 Kbps stereo)
24 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Audio for CD-quality transparency (128 Kbps stereo)
25 | WMA 22,050 Hz; 16 Bit; Stereo; 32 kbps. | Video for color PDA devices (225 Kbps)
26 | WMA 22,050 Hz; 16 Bit; Stereo; 32 kbps. | Video for color PDA devices (150 Kbps)
27 | WMA 22,050 Hz; 16 Bit; Stereo; 32 kbps. | Windows Media Video 8 for Color Pocket PCs (225 Kbps)
28 | WMA 22,050 Hz; 16 Bit; Stereo; 32 kbps. | Windows Media Video 8 for Color Pocket PCs (150 Kbps)
29 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Windows Media Video 8 for Dial-up Modems or Single-channel ISDN (28.8 to 56 Kbps)
30 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Windows Media Video 8 for LAN, Cable Modem, or xDSL (100 to 768 Kbps)
31 | WMA 8,000 Hz; 16 Bit; Mono; 8 kbps. | Windows Media Video 8 for Dial-up Modems or LAN (28.8 to 100 Kbps)
32 | WMA 8,000 Hz; 16 Bit; Mono; 5 kbps. | Windows Media Video 8 for Dial-up Modems (28.8 Kbps)
33 | WMA 11,025 Hz; 16 Bit; Mono; 10 kbps. | Windows Media Video 8 for Dial-up Modems (56 Kbps)
34 | WMA 16,000 Hz; 16 Bit; Mono; 16 kbps. | Windows Media Video 8 for Local Area Network (100 Kbps)
35 | WMA 32,000 Hz; 16 Bit; Stereo; 40 kbps. | Windows Media Video 8 for Local Area Network (256 Kbps)
36 | WMA 32,000 Hz; 16 Bit; Stereo; 48 kbps. | Windows Media Video 8 for Local Area Network (384 Kbps)
37 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media Video 8 for Local Area Network (768 Kbps)
38 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media Video 8 for Broadband (NTSC, 700 Kbps)
39 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Windows Media Video 8 for Broadband (NTSC, 1400 Kbps)
40 | WMA 32,000 Hz; 16 Bit; Stereo; 48 kbps. | Windows Media Video 8 for Broadband (PAL, 384 Kbps)
41 | WMA 44,000 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media Video 8 for Broadband (PAL, 700 Kbps)
42 | WMA 22,050 Hz; 16 Bit; Mono; 20 kbps. | Windows Media Audio 8 for Dial-up Modem (Mono, 28.8 Kbps)
43 | WMA 22,050 Hz; 16 Bit; Stereo; 20 kbps. | Windows Media Audio 8 for Dial-up Modem (FM Radio Stereo, 28.8 Kbps)
44 | WMA 32,000 Hz; 16 Bit; Stereo; 32 kbps. | Windows Media Audio 8 for Dial-up Modem (32 Kbps)
45 | WMA 44,100 Hz; 16 Bit; Stereo; 48 kbps. | Windows Media Audio 8 for Dial-up Modem (Near CD quality, 48 Kbps)
46 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media Audio 8 for Dial-up Modem (CD quality, 64 Kbps)
47 | WMA 44,100 Hz; 16 Bit; Stereo; 96 kbps. | Windows Media Audio 8 for ISDN (Better than CD quality, 96 Kbps)
48 | WMA 44,100 Hz; 16 Bit; Stereo; 128 kbps. | Windows Media Audio 8 for ISDN (Better than CD quality, 128 Kbps)
49 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media 8 Fair Quality based VBR for Broadband
50 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media 8 High Quality based VBR for Broadband.
51 | WMA 44,100 Hz; 16 Bit; Stereo; 64 kbps. | Windows Media 8 Best Quality based VBR for Broadband.

Example:

' VB sample where File is an AudioFile2 object.
File.WmaFormatEnabled = True
File.SetFormatWMA 32

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX

Applies to: AudioFile2


WriteFile method

WriteFile method

Writes an audio data array to the audio file, created by the CreateFile method.

Syntax

object.WriteFile(WavArray As Integer())

The WriteFile method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
WavArray | Integer() | Audio data array.

Remarks:

This method changes the Duration property.

Example:

' VB sample where FileW and FileR are AudioFile2 objects.
Private Sub Convert()
    On Error GoTo Err_Convert
    FileR.OpenFile FileName1  'Opens an input file, path and filename are stored in Filename1 string

        FileW.CreateFile FileName2

        FileW.SetFormatArray FileR.ArrayFrequency, FileR.ArrayChannels 'Sets audio file format using FileR frequency and nChannels
        BufferSize = FileR.ArrayChannels * FileR.ArrayFrequency   'Sets the BufferSize to the Frequency of an input audio file
        CurrentSamples = 0  'Sets the current sample to zero
        Do While True
            Wav() = FileR.ReadFile(BufferSize) 'reads from an audio file a piece of data of Buffer size to the Wav variable
            If UBound(Wav) + 1 = 0 Then Exit Do
            FileW.WriteFile Wav()  'otherwise write currently read data block to the new created audio file
            CurrentSamples = CurrentSamples + (UBound(Wav) + 1) / FileR.nChannels   'enlarge number of the currently read samples
            If CurrentSamples > FileR.nSamples Then CurrentSamples = FileR.nSamples   'if number of the currently read samples is more than the one in an AudioFile2
            ProgressConvert.Value = CurrentSamples * 100 / FileR.nSamples   'the value of progress bar line equals 100%*Currently read samples/Samples at all
            DoEvents
            If flgConvert = False Then Exit Do
        Loop

        ProgressConvert.Value = 100       'shows 100% of line on the Progress bar
    FileW.CloseFile
    P:
    FileR.CloseFile              'Close an input audio file

    Exit_Convert:
        Exit Sub

    Err_Convert:
    MsgBox Err.Description
    Resume Exit_LoadPlayBuffer

End Sub

See Also:

CloseFile | CreateFile | OpenFile | ReadFile | SeekFile

Applies to: AudioFile2


AudioFile2LameEnc

AudioFile2LameEnc object

The AudioFile2LameEnc object is intended for changing the parameters of the lame mp3 encoder.

Send Feedback on the NCTAudioFile2 documentation.
NCTAudioFile2 was developed by NCT company http://www.nctsoft.com


AudioFile2LameEnc Properties

Properties (AudioFile2LameEnc object)

Property | Type | Default | Description
AbrBitrate | Integer |  | Gets or sets maximum ABR/VBR bitrate.
ATHControlMode | Integer |  | Gets or sets ATH (absolute threshold of hearing).
Bitrate | BitrateConstants | BR_128_KBPS | Gets or sets bitrate of an MP3 file.
BitReservoir | Boolean | True | Gets or sets a flag indicating if the bit reservoir is used or not. Each frame will then become independent from the previous ones, but the quality will be lower.
BlockTypeControl | Boolean |  | Gets or sets a flag indicating if the block type control is enabled or not. The block type control allows block types to differ between channels.
Channels | ChannelsConstants |  | Gets or sets the number of channels in the MP3 file.
Emphasis | Integer |  | Gets or sets the type of emphasis of the audio array.
EncoderQuality | Integer |  | Gets or sets encoder quality.
ErrorProtection | Boolean |  | Gets or sets a flag indicating if the error protection is enabled or not.
Frequency | FrequencyConstants | FQ_44_KHZ | Gets or sets the frequency of an MP3 file.
HighPassFrequency | Long |  | Gets or sets the frequency for high pass filtering.
HighPassWidth | Long |  | Gets or sets the width of high pass filtering.
LowPassFrequency | Long |  | Gets or sets the frequency for low pass filtering.
LowPassWidth | Long |  | Gets or sets the width of low pass filtering.
ShortBlocks | Boolean |  | Gets or sets a flag indicating if the short blocks are used or not.
StrictISOCompliance | Boolean |  | Gets or sets a flag indicating if ISO MPEG specification is enabled or not.
StrictlyEnforceMinBitrate | Boolean |  | Gets or sets a flag indicating if the minimum bitrate is enforced or not.
TypeStereo | Mp3LameTypeStereoConstants |  | Gets or sets the type of stereo realization.
VbrBitrate | BitrateConstants |  | Gets or sets VBR bitrate.
VbrCodingMethod | Mp3LameMethodConstants |  | Gets or sets the type of lame method.
VbrQuality | Integer |  | Gets or sets VBR quality.
WritingVBRHeader | Boolean |  | Gets or sets a flag indicating if VBR header is included to the audio file or not.


AbrBitrate property (AudioFile2LameEnc)

AbrBitrate property (AudioFile2LameEnc)

Gets or sets maximum ABR/VBR bitrate.

Property type

An Integer value.

Syntax

object.AbrBitrate [= value]

The AbrBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Integer | Maximum ABR/VBR bitrate. Varies from 10 to 310.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.VbrCodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


ATHControlMode property (AudioFile2LameEnc)

ATHControlMode property (AudioFile2LameEnc)

Gets or sets ATH (absolute threshold of hearing).

Property type

An Integer value.

Syntax

object.ATHControlMode [= value]

The ATHControlMode property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Integer | Can be one of the following values: 1 - default, 2 - ATH only (ignore psychoacoustics' model, use ATH only), 3 - disable ATH (use psychoacoustics' model only), 4 - ATH only for short block (ignore psychoacoustics' model for short blocks, use ATH only).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


Bitrate property (AudioFile2LameEnc)

Bitrate property (AudioFile2LameEnc)

Gets or sets bitrate of an MP3 file.

Property type

A BitrateConstants value.

Syntax

object.Bitrate [= value]

The AbrBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | BitrateConstants | Bitrate of the MP3 file. By default the value is set to BR_128_KBPS.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


BitResorvoir property (AudioFile2LameEnc)

BitReservoir property (AudioFile2LameEnc)

Gets or sets a flag indicating if the bit reservoir is used or not. Each frame will then become independent from the previous ones, but the quality will be lower.

Property type

A Boolean value.

Syntax

object.BitReservoir [= value]

The BitResorvoir property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Boolean | Can be True (bit reservoir is used) or False (bit reservoir isn't used). By default is True.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


BlockTypeControl property (AudioFile2LameEnc)

BlockTypeControl property (AudioFile2LameEnc)

Gets or sets a flag indicating if the block type control is enabled or not. The block type control allows block types to differ between channels.

Property type

A Boolean value.

Syntax

object.BlockTypeControl [= value]

The BlockTypeControl property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Boolean | Can be True (block type control is enabled) or False (block type control is disabled).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


Channels property (AudioFile2LameEnc)

Channels property (AudioFile2LameEnc)

Gets or sets the number of channels in the MP3 file. Mono data uses one channel and stereo data uses two channels.

Property type

A ChannelsConstants value.

Syntax

object.Channels [= value]

The AbrBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | ChannelsConstants | Number of channels of an MP3 file. By default the value is equal to STEREO.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


Emphasis property (AudioFile2LameEnc)

Emphasis property (AudioFile2LameEnc)

Gets or sets the type of emphasis of the audio array.

Property type

An Integer value.

Syntax

object.Emphasis [= value]

The Emphasis property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Integer | Can be one of the following values: 1 - none (default), 2 - 0/15 microseconds, 3 - citt j.17.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


EncoderQuality property (AudioFile2LameEnc)

EncoderQuality property (AudioFile2LameEnc)

Gets or sets encoder quality.

Property type

An Integer value.

Syntax

object.EncoderQuality [= value]

The EncoderQuality property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Integer | Varies from 0 (the best quality and the worst speed) to 9 (the worst quality and the best speed).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.EncoderQuality = 7
LameEnc.TypeStereo = 2
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


ErrorProtection property (AudioFile2LameEnc)

ErrorProtection property (AudioFile2LameEnc)

Gets or sets a flag indicating if the error protection is enabled or not.

Property type

A Boolean value.

Syntax

object.ErrorProtection [= value]

The ErrorProtection property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object of type .
value | Boolean | Can be True (error protection is enabled) or False (error protection is disabled).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.EncoderQuality = 7
LameEnc.TypeStereo = 2
LameEnc.ErrorProtection = True
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


Frequency property (AudioFile2LameEnc)

Frequency property (AudioFile2LameEnc)

Gets or sets the frequency of an MP3 file.

Property type

A FrequencyConstants value.

Syntax

object.Frequency [= value]

The AbrBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | FrequencyConstants | Frequency of the MP3 file. By default the value is equal to FQ_44_KHZ.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


HighPassFrequency property (AudioFile2LameEnc)

HighPassFrequency property (AudioFile2LameEnc)

Gets or sets the frequency for high pass filtering.

Property type

A Long value.

Syntax

object.HighPassFrequency [= value]

The HighPassFrequency property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Long | Frequency, in hertz.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
LameEnc.HighPassFrequency = 30
LameEnc.HighPassWidth = 5
LameEnc.LowPassFrequency = 15160
LameEnc.LowPassWidth = 760
File.SetFormatMP3Ex LameEnc

See Also:

HighPassWidth

Applies to: AudioFile2LameEnc


HighPassWidth property (AudioFile2LameEnc)

HighPassWidth property (AudioFile2LameEnc)

Gets or sets the width of high pass filtering.

Property type

A Long value.

Syntax

object.HighPassWidth [= value]

The HighPassWidth property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Long | Width of high pass filtering, in hertz.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
LameEnc.HighPassFrequency = 30
LameEnc.HighPassWidth = 5
LameEnc.LowPassFrequency = 15160
LameEnc.LowPassWidth = 760
File.SetFormatMP3Ex LameEnc

See Also:

HighPassFrequency

Applies to: AudioFile2LameEnc


LowPassFrequency property (AudioFile2LameEnc)

LowPassFrequency property (AudioFile2LameEnc)

Gets or sets the frequency for low pass filtering.

Property type

A Long value.

Syntax

object.LowPassFrequency [= value]

The LowPassFrequency property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Long | Frequency, in hertz.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
LameEnc.HighPassFrequency = 30
LameEnc.HighPassWidth = 5
LameEnc.LowPassFrequency = 15160
LameEnc.LowPassWidth = 760
File.SetFormatMP3Ex LameEnc

See Also:

LowPassWidth

Applies to: AudioFile2LameEnc


LowPassWidth property (AudioFile2LameEnc)

LowPassWidth property (AudioFile2LameEnc)

Gets or sets the width of low pass filtering.

Property type

A Long value.

Syntax

object.LowPassWidth [= value]

The LowPassWidth property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Long | Width of low pass filtering, in hertz.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
LameEnc.HighPassFrequency = 30
LameEnc.HighPassWidth = 5
LameEnc.LowPassFrequency = 15160
LameEnc.LowPassWidth = 760
File.SetFormatMP3Ex LameEnc

See Also:

LowPassFrequency

Applies to: AudioFile2LameEnc


ShortBlocks property (AudioFile2LameEnc)

ShortBlocks property (AudioFile2LameEnc)

Gets or sets a flag indicating if the short blocks are used or not.

Property type

A Boolean value.

Syntax

object.ShortBlocks [= value]

The ShortBlocks property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object of type .
value | Boolean | Can be True (short blocks are used) or False (short blocks aren't used).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


StrictISOCompliance property (AudioFile2LameEnc)

StrictISOCompliance property (AudioFile2LameEnc)

Gets or sets a flag indicating if ISO MPEG specification is enabled or not.

Property type

A Boolean value.

Syntax

object.StrictISOCompliance [= value]

The StrictISOCompliance property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Boolean | Can be True (ISO MPEG specification is enabled) or False (ISO MPEG specification is disabled).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = FQ_24_KHZ
LameEnc.Bitrate = BR_160_KBPS
LameEnc.Channels = 2
LameEnc.ATHControlMode = 4
LameEnc.ShortBlocks = True
LameEnc.BitReservoir = True
LameEnc.BlockTypeControl = False
LameEnc.StrictISOCompliance = False
LameEnc.Emphasis = 3
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


StrictlyEnforeMinBitrate property (AudioFile2LameEnc)

StrictlyEnforceMinBitrate property (AudioFile2LameEnc)

Gets or sets a flag indicating if the minimum bitrate is enforced or not.

Property type

A Boolean value.

Syntax

object.StrictlyEnforceMinBitrate [= value]

The StrictlyEnforceMinBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Boolean | False if the minimum bitrate is ignored for passages of analog silence, otherwise -True.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.CodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


TypeStereo property (AudioFile2LameEnc)

TypeStereo property (AudioFile2LameEnc)

Gets or sets the type of stereo realization.

Property type

An Mp3LameTypeStereoConstants value.

Syntax

object.TypeStereo [= value]

The TypeStereo property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Mp3LameTypeStereoConstants | Type of stereo.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.EncoderQuality = 7
LameEnc.TypeStereo = 2
File.SetFormatMP3Ex LameEnc

See Also:

Applies to: AudioFile2LameEnc


VbrBitrate property (AudioFile2LameEnc)

VbrBitrate property (AudioFile2LameEnc)

Gets or sets VBR bitrate.

Property type

A BitrateConstants value.

Syntax

object.VbrBitrate [= value]

The VbrBitrate property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | BitrateConstants | Type of bitrate.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.CodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

VbrCodingMethod | VbrQuality | WritingVBRHeader

Applies to: AudioFile2LameEnc


VbrCodingMethod property (AudioFile2LameEnc)

VbrCodingMethod property (AudioFile2LameEnc)

Gets or sets the type of lame method.

Property type

An Mp3LameMethodConstants value.

Syntax

object.VbrCodingMethod [= value]

The VbrCodingMethod property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Mp3LameMethodConstants | Type of lame method.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.CodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

VbrBitrate | VbrQuality | WritingVBRHeader

Applies to: AudioFile2LameEnc


VbrQuality property (AudioFile2LameEnc)

VbrQuality property (AudioFile2LameEnc)

Gets or sets VBR quality.

Property type

An Integer value.

Syntax

object.VbrQuality [= value]

The VbrQuality property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Integer | Varies from 0 (the best quality and the worst speed) to 9 (the worst quality and the best speed).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.CodingMethod = VBR_NEW
LameEnc.VbrQuality = 7
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

VbrBitrate | VbrCodingMethod | WritingVBRHeader

Applies to: AudioFile2LameEnc


WritingVBRHeader property (AudioFile2LameEnc)

WritingVBRHeader property (AudioFile2LameEnc)

Gets or sets a flag indicating if VBR header is included to the audio file or not.

Property type:

A Boolean value.

Syntax

object.WritingVBRHeader [= value]

The WritingVBRHeader property syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
value | Boolean | Can be True (VBR header is included) or False (VBR header isn't included).

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.Frequency = Frequency
LameEnc.Bitrate = Bitrate
LameEnc.Channels = Channels
LameEnc.CodingMethod = VBR_ABR
LameEnc.AbrBitrate = 128
LameEnc.VbrBitrate = BR_192_KBPS
LameEnc.WritingVBRHeader = True
LameEnc.StrictlyEnforceMinBitrate = False
File.SetFormatMP3Ex LameEnc

See Also:

VbrBitrate | VbrCodingMethod | VbrQuality

Applies to: AudioFile2LameEnc


AudioFile2LameEnc Methods

Methods (AudioFile2LameEnc object)

Method | Description
SetParamsFromAltPreset | Sets the parameters of the lame mp3 encoder from the "alternate" preset.
SetParamsFromCommandLine | Sets the parameters of the lame mp3 encoder from the command line.
SetParamsFromPreset | Sets the parameters of the lame mp3 encoder from the preset.


SetParamsFromAltPreset method

SetParamsFromAltPreset method

Sets the parameters of the lame mp3 encoder from the "alternate" preset.

Syntax

object.SetParamsFromAltPreset(Preset As Integer)

The SetParamsFromAltPreset method syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
Preset | Integer | Number of "alternate" preset. Can be one of the following values: 0 - None (abolition of preset parameters), 1 - Fast Standard, 2 - Standard, 3 - Fast Extreme, 4 - Extreme, 5 - Insane. By default is equal to None.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.SetParamsFromAltPreset 1
File.SetFormatMP3Ex LameEnc

See Also:

SetParamsFromCommandLine | SetParamsFromPreset

Applies to: AudioFile2LameEnc


SetParamsFromCommandLine method

SetParamsFromCommandLine method

Sets the parameters of lame mp3 encoder from command line.

Syntax

object.SetParamsFromCommandLine(CommandLine As String)

The SetParamsFromCommandLine method syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
CommandLine | String | Command string.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
Dim Text As String
LameEnc.SetParamsFromCommandLine Text
File.SetFormatMP3Ex LameEnc

See Also:

SetParamsFromAltPreset | SetParamsFromPreset

Applies to: AudioFile2LameEnc


SetParamsFromPreset method

SetParamsFromPreset method

Sets the parameters of the lame mp3 encoder from the preset.

Syntax

object.SetParamsFromPreset(Preset As Integer)

The SetParamsFromPreset method syntax has these parts:

Part | Type | Description
object | AudioFile2LameEnc | An expression evaluating to an object.
Preset | Integer | Number of preset. Can be one of the following values: 0 - None (abolition of preset parameters), 1 - Phone, 2 - SW, 3 - AM, 4 - FM, 5 - Voice, 6 - Radio, 7 - Tape, 8 - HiFi, 9 - CD, 10 - Studio, 11 - R3Mix. By default is equal to None.

Example:

' VB sample where File is an AudioFile2 object, LameEnc is an AudioFile2LameEnc object.
LameEnc.SetParamsFromPreset 8
File.SetFormatMP3Ex LameEnc

See Also:

SetParamsFromAltPreset | SetParamsFromCommandLine

Applies to: AudioFile2LameEnc


AudioFile2 Constants

Constants

Constants | Description
ALF2CDBitrateConstants | These are the constants for the SetFormatALF2CD method (AudioFile2 object).
BitrateConstants | These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatMP2, SetFormatMP3, SetFormatOggVorbis methods (AudioFile2 object) and Bitrate, VbrBitrate properties (AudioFile2LameEnc object).
BitsPerSampleConstants | These are the constants for the SetFormatG723, SetFormatG726, SetFormatPCM, SetFormatRaw methods and BitsPerSample, G723BitsPerSample, G763BitsPerSample properties (AudioFile2 object).
ChannelsConstants | These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatADPCM, SetFormatALAW, SetFormatArray, SetFormatMP3, SetFormatOggVorbis, SetFormatPCM, SetFormatRAW, SetFormatULAW methods (AudioFile2 object), ArrayChannels, nChannels properties (AudioFile2 object) and Channels property (AudioFile2LameEnc object).
ErrorConstants | These are the constants for the Error event and LastErrorNum property (AudioFile2 object).
FileSeekConstants | These are the constants for the SeekFile method (AudioFile2 object).
FlagOpen | These are the constants for the OpenFile method (AudioFile2 object).
FormatTypeConstants | These are the constants for the CreateFile, OpenFile methods (AudioFile2 object).
FrequencyConstants | These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatADPCM, SetFormatALAW, SetFormatArray, SetFormatG721, SetFormatG723, SetFormatG726, SetFormatGSM, SetFormatMobileVoice, SetFormatMP2, SetFormatMP3, SetFormatOggVorbis, SetFormatPCM, SetFormatRAW, SetFormatULAW, SetFormatVOX methods (AudioFile2 object), ArrayFrequency, Frequency properties (AudioFile2 object) and Frequency property (AudioFile2LameEnc object).
Mp3DecoderConstants | These are the constants for the Mp3DecoderType property (AudioFile2 object).
Mp3EncoderConstants | These are the constants for the Mp3EncoderType property (AudioFile2 object).
Mp3LameMethodConstants | These are the constants for the VbrCodingMethod property (AudioFile2LameEnc object).
Mp3LameTypeStereoConstants | These are the constants for the TypeStereo property (AudioFile2LameEnc object).
RawTypeCompressConstants | These are the constants for the SetFormatRaw property (AudioFile2 object).


BitrateConstants enumeration

BitrateConstants enumeration

These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatMP2, SetFormatMP3, SetFormatOggVorbis methods (AudioFile2 object) and Bitrate, VbrBitrate properties (AudioFile2LameEnc object).

Members

Part | Value | Description
BR_350_KBPS | 350 | 350 kbits per second.
BR_320_KBPS | 320 | 320 kbits per second.
BR_256_KBPS | 256 | 256 kbits per second.
BR_224_KBPS | 224 | 224 kbits per second.
BR_192_KBPS | 192 | 192 kbits per second.
BR_160_KBPS | 160 | 160 kbits per second.
BR_128_KBPS | 128 | 128 kbits per second.
BR_112_KBPS | 112 | 112 kbits per second.
BR_96_KBPS | 96 | 96 kbits per second.
BR_80_KBPS | 80 | 80 kbits per second.
BR_64_KBPS | 64 | 64 kbits per second.
BR_56_KBPS | 56 | 56 kbits per second.
BR_48_KBPS | 48 | 48 kbits per second.
BR_40_KBPS | 40 | 40 kbits per second.
BR_32_KBPS | 32 | 32 kbits per second.
BR_24_KBPS | 24 | 24 kbits per second.
BR_16_KBPS | 16 | 16 kbits per second.
BR_8_KBPS | 8 | 8 kbits per second.
BR_NONE | 0 | none


BitsPerSampleConstants enumeration

BitsPerSampleConstants enumeration

These are the constants for the SetFormatG723, SetFormatG726, SetFormatPCM, SetFormatRaw methods and BitsPerSample, G723BitsPerSample, G763BitsPerSample properties (AudioFile2 object).

Members

Constant | Value | Description
BPS_2_BIT | 2 | 2 bits per sample.
BPS_3_BIT | 3 | 3 bits per sample.
BPS_4_BIT | 4 | 4 bits per sample.
BPS_5_BIT | 5 | 5 bits per sample.
BPS_8_BIT | 8 | 8 bits per sample.
BPS_16_BIT | 16 | 16 bits per sample.
BPS_24_BIT | 24 | 24 bits per sample.
BPS_32_BIT | 32 | 32 bits per sample.


ChannelsConstants enumeration

ChannelsConstants enumeration

These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatADPCM, SetFormatALAW, SetFormatArray, SetFormatMP3, SetFormatOggVorbis, SetFormatPCM, SetFormatRAW, SetFormatULAW methods (AudioFile2 object), ArrayChannels, nChannels properties (AudioFile2 object) and Channels property (AudioFile2LameEnc object).

Members

Constant | Value | Description
MONO | 1 | Mono data uses one channel.
STEREO | 2 | Stereo data uses two channels.


ErrorConstants enumeration

ErrorConstants enumeration

These are the constants for the Error event and LastErrorNum property (AudioFile2 object).

Members

Part | Value | Description
NOERRORS | 0 | No errors.
BUSY | -10 | It is impossible to execute the current method because the application is busy by another one.
MEMORY | -11 | Memory error.
FORMATFILE | -12 | Wrong file format. It is an attempt to open a non-audio file as an audio file.
FORMATNOTSUPPORT | -13 | Unsupported audio file format. It is an attempt to open an unsupported audio file format.
OUTDRIVER | -14 | Output audio device error. For example: wrong device, audio device is already opened in your application or is in use by another one and many others… It hardly depends on hardware.
INPDRIVER | -15 | Input audio device error. . For example: wrong device, audio device is already opened in your application or is in use by another one and many others… It hardly depends on hardware.
MIXERDRIVER | -16 | Mixer device driver error.
ACMDRIVER | -17 | ACM driver error.
FILEACCESS | -18 | The specified file is already in use.
INVALIDOPERATION | -19 | Invalid operation. For example, you try to execute READ method before OPEN method.
INVALIDPARAM | -20 | Invalid parameters. You try to execute a method with invalid parameters.
ASPIDRIVER | -21 | Incorrect CD driver operation. ASPI driver returns an error.
CONTROLNOTINSTALLED | -22 | Control not installed.
INDEXOUTOFRANGE | -23 | Incorrect address to the array. Index out of the array range.
STREAM | -24 |
UNEXPECTED | -40 | Unexpected error.


FileSeekConstants enumeration

FileSeekConstants enumeration

These are the constants for the SeekFile method (AudioFile2 object).

Members

Constant | Value | Description
CURRENT_POS | 1 | Current position.
BEGIN_POS | 3 | Beginning of file.
END_POS | 2 | End of file.


FlagOpen enumeration

FlagOpen enumeration

These are the constants for the OpenFile method (AudioFile2 object).

Members

Constant | Value | Description
READ | 1 | File is opened for reading.
READWRITE | 2 | File is opened for reading and rewriting.


FormatTypeConstants enumeration

FormatTypeConstants enumeration

These are the constants for the CreateFile, OpenFile methods (AudioFile2 object).

Members

Constant | Value | Description
DEFAULT | 0 | Default.
WAV | 1 | WAV audio file format.
MP3 | 2 | MP3 audio file format.
VOX | 3 | VOX audio file format.
RAW | 4 | RAW audio file format.
G726 | 5 | G726 audio file format.
OGG | 6 | OGG audio file format.
G721 | 7 | G721 audio file format.
G723 | 8 | G723 audio file format.
AVI | 9 | AVI audio file format.
MPC | 10 | MPC audio file format.
MP2 | 12 | MP2 audio file format.
WMA | 11 | WMA audio file format.


FrequencyConstants enumeration

FrequencyConstants enumeration

These are the constants for the IsFormatMpegAvailable, IsFormatOggVorbisAvailable, SetFormatADPCM, SetFormatALAW, SetFormatArray, SetFormatG721, SetFormatG723, SetFormatG726, SetFormatGSM, SetFormatMobileVoice, SetFormatMP2, SetFormatMP3, SetFormatOggVorbis, SetFormatPCM, SetFormatRAW, SetFormatULAW, SetFormatVOX methods (AudioFile2 object), ArrayFrequency, Frequency properties (AudioFile2 object) and Frequency property (AudioFile2LameEnc object).

Members

Constant | Value | Description
FQ_96_KHZ | 96000 | 96000 hertz.
FQ_88_KHZ | 88200 | 88200 hertz.
FQ_48_KHZ | 48000 | 48000 hertz.
FQ_44_KHZ | 44100 | 44100 hertz.
FQ_32_KHZ | 32000 | 32000 hertz.
FQ_24_KHZ | 24000 | 24000 hertz.
FQ_22_KHZ | 22050 | 22050 hertz.
FQ_16_KHZ | 16000 | 16000 hertz.
FQ_12_KHZ | 12000 | 12000 hertz.
FQ_11_KHZ | 11025 | 11025 hertz.
FQ_8_KHZ | 8000 | 8000 hertz.
FQ_6_KHZ | 6000 | 6000 hertz.


Mp3DecoderConstants enumeration

Mp3DecoderConstants enumeration

These are the constants for the Mp3DecoderType property (AudioFile2 object).

Members

Constant | Value
ACM_DRIVER_OUT | 1
X_AUDIO | 2
MAD | 3


Mp3EncoderConstants enumeration

Mp3EncoderConstants enumeration

These are the constants for the Mp3EncoderType property (AudioFile2 object).

Members

Constant | Value
ACM_DRIVER_IN | 1
LAME | 2


Mp3LameMethodConstants enumeration

Mp3LameMethodConstants enumeration

These are the constants for the VbrCodingMethod property (AudioFile2LameEnc object).

Members

Constant | Value
VBR_NONE | -1
VBR_DEFAULT | 0
VBR_OLD | 1
VBR_NEW | 2
VBR_MTRH | 3
VBR_ABR | 4


Mp3LameTypeStereoConstants enumeration

Mp3LameTypeStereoConstants enumeration

These are the constants for the TypeStereo property (AudioFile2LameEnc object).

Members

Constant | Value | Description
SIMPLY | 1 | Does not use potentially existing correlations between the two input channels.
JOINTSTEREO | 2 | Uses the correlation between both channels.
FORCEDJOINTSTEREO | 3 | Forces MS joint stereo on all frames.
DUALCHANNEL | 4 | The two channels will be totally independently encoded.


RawTypeCompressConstants enumeration

RawTypeCompressConstants enumeration

These are the constants for the SetFormatRaw property (AudioFile2 object).

Members

Constant | Value
PCM | 1
ALAW | 2
ULAW | 3
GSM | 4
IMA_ADPCM | 5
MS_ADPCM | 6


Mp3LameEncoder property (AudioFile2)

Mp3LameEncoder property (AudioFile2)

Read-only property that returns to AudioFile2LameEnc object which used for changing parameters of lame mp3 encoder. This property opened by the OpenFile method or created by the CreateFile method.

Property type

An AudioFile2LameEnc value.

Syntax

object.Mp3LameEncoder [= value]

The Mp3LameEncoder property syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
value | AudioFile2LameEnc | An expression evaluating to an object.

Example:

' VB sample where File is an AudioFile2 object.
If File.IsFormatMpegAvailable(File.Mp3LameEncoder.Frequency, File.Mp3LameEncoder.Bitrate, File.Mp3LameEncoder.Channels + File.Mp3LameEncoder.TypeStereo - 1) = True Then 'MP2
File.SetFormatMP2 File.Mp3LameEncoder.Frequency, File.Mp3LameEncoder.Bitrate, File.Mp3LameEncoder.Channels + File.Mp3LameEncoder.TypeStereo - 1
End If

See Also:

Applies to: AudioFile2


SetFormatALF2CD method

SetFormatALF2CD method

Sets the format of an ALF2 CD audio file.

Syntax

object.SetFormatALF2CD(Bitrate As ALF2CDBitrateConstants)

The SetFormatALF2CD method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Bitrate | ALF2CDBitrateConstants | Bitrate of an audio file. By default the Bitrate is equal to ALF2CD_256_KBPS.

Remarks:

You should apply this method before creating ALF2 CD file by the CreateFile method or before opening ALF2 CD file by the OpenFile method.

Example:

' VB sample where File is an AudioFile2 object.
File.SetFormatALF2CD ALF2CD_320_KBPS

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMobileVoice | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


SetFormatMobileVoice method

SetFormatMobileVoice method

Sets the format of a Mobile Voice audio file.

Syntax

object.SetFormatMobileVoice(Frequency As FrequencyConstants)

The SetFormatMobileVoice method syntax has these parts:

Part | Type | Description
object | AudioFile2 | An expression evaluating to an object.
Frequency | FrequencyConstants | Frequency of the audio file. By default the Frequency is equal to FQ_8_KHZ.

Remarks:

You should apply this method before creating GSM file by the CreateFile method.

Example:

' VB sample where File is an AudioFile2 object.
If TypeComp = 1 Then
File.SetFormatADPCM Freq, Chann
ElseIf TypeComp = 2 Then
File.SetFormatALAW Freq, Chann
ElseIf TypeComp = 3 Then
File.SetFormatDSP
ElseIf TypeComp = 4 Then
File.SetFormatGSM Freq
ElseIf TypeComp = 5 Then
File.SetFormatMobileVoice Freq
ElseIf TypeComp = 6 Then
File.SetFormatULAW Freq, Chann
End If

See Also:

SetFormatADPCM | SetFormatALAW | SetFormatALF2CD | SetFormatArray | SetFormatDSP | SetFormatFromMenu | SetFormatG721 | SetFormatG723 | SetFormatG726 | SetFormatGSM | SetFormatLikeSample | SetFormatMP2 | SetFormatMP3 | SetFormatMP3Ex | SetFormatOggVorbis | SetFormatPCM | SetFormatRAW | SetFormatULAW | SetFormatVOX | SetFormatWMA

Applies to: AudioFile2


NCTAudioFile2Lib

NCTAudioStudio2 ActiveX DLLs

Version 2.2

With NCTAudioFile2 you can:

  • Open audio files.

  • Read audio data from opened files.

  • Change current position in an audio file.

  • Create new audio files.

  • Set the format of audio files.

  • Write audio data to audio files.

  • Convert audio files from one format to another.

  • Split and append audio files.

The following audio formats are supported:

  • WAV PCM;

  • Compressed WAV (GSM, ADPCM, DSP, ALAW, ULAW, ALF2 CD and others);

  • MP2;

  • MP3 (including files with VBR (variable bitrate);

  • WMA;

  • VOX;

  • RAW (PCM);

  • G.721, G.723, G.726;

  • Mobile Voice;

  • MPC;

  • Ogg Vorbis.

NCTAudioFile2 is a part of the NCTAudioStudio2 package.